﻿@inherits BAdminBase
<BPopup></BPopup>
<CascadingAuthenticationState>
    <CascadingValue Value="this">
        <AuthorizeView>
            <Authorized>
                <BLayout WestWidth="@NavigationWidth">
                    <West>
                        <BCard Style="background-color:#20222A;" Shadow="@ShadowShowType.Never">
                            <Header>
                                @NavigationTitle
                            </Header>
                            <Body>
                                <BMenu Mode="@MenuMode.Vertical" @bind-ActiveItem="@CurrentMenu" EnableAlwaysRender="true" DefaultActive="@defaultMenuIndex" BackgroundColor="#20222A" ActiveTextColor="#FFFFFF" TextColor="rgba(255,255,255,.7)" HoverColor="#434A50">
                                    @foreach (var menu in Menus)
                                    {
                                        if (menu.Children != null && menu.Children.Any())
                                        {
                                            @if (!RequireHide(menu.Children))
                                            {
                                                <BSubMenu Label="@menu.Label" Icon="@menu.Icon">
                                                    @foreach (var children in menu.Children)
                                                    {
                                                        @if (!RequireHide(children))
                                                        {
                                                            <BMenuItem Route="@children.Route" Icon="@children.Icon" Index="@children.Name" Model="@children">@children.Label</BMenuItem>
                                                        }
                                                    }
                                                </BSubMenu>
                                            }
                                        }
                                        else
                                        {
                                            @if (!RequireHide(menu))
                                            {
                                                <BMenuItem Route="@menu.Route" Icon="@menu.Icon" Index="@menu.Name" Model="@menu">@menu.Label</BMenuItem>
                                            }
                                        }
                                    }
                                </BMenu>
                            </Body>
                        </BCard>
                    </West>
                    <Center>
                        <BForm @ref="form"></BForm>
                        <div class="navbar">
                            <div class="tools">
                                <BBreadcrumb @ref="breadcrumb">
                                    <BBreadcrumbItem>@BreadcrumbTitle</BBreadcrumbItem>
                                    @if (CurrentMenu != null)
                                    {
                                        <BBreadcrumbItem>@(((MenuModel)CurrentMenu.Model).Title)</BBreadcrumbItem>
                                    }
                                </BBreadcrumb>
                            </div>
                            <div class="fill"></div>
                            <div class="tools">

                                <BDropDown Style="cursor:pointer;">
                                    <Trigger>
                                        <span class="el-dropdown-link">
                                            @username  <i class="el-icon-arrow-down el-icon--right"></i>
                                        </span>
                                    </Trigger>
                                    <Items>
                                        @if (PersonMenus != null)
                                        {
                                            @PersonMenus
                                        }
                                        <BDropDownItem OnClick="ModifyPasswordAsync">修改密码</BDropDownItem>
                                        <BDropDownItem OnClick="LogoutAsync">注销登录</BDropDownItem>
                                    </Items>
                                </BDropDown>
                            </div>
                        </div>
                        <BTab Type="@TabType.Card" DataSource="Tabs" @ref="tab">
                        </BTab>
                    </Center>
                </BLayout>
            </Authorized>
            <NotAuthorized>
                <BNotAuthorized LoginPage="LoginPage" CreatePage="CreatePage" DefaultUser="DefaultUser"></BNotAuthorized>
            </NotAuthorized>
        </AuthorizeView>
    </CascadingValue>
</CascadingAuthenticationState>